#!/usr/bin/env python3
from gi.repository import Gtk, GObject
import sys

line = sys.stdin.readline()
issue = line.lower()
message = "Skickar " + issue + ". Vänta..."

class ProgressBar(Gtk.Window):
    def __init__(self):
        Gtk.Window.__init__(self, title=message)
        self.set_border_width(10)
        self.set_default_size(300, 40)
        self.set_icon_name("mail-message-new")
        self.set_position(Gtk.WindowPosition.CENTER)        
        vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=6)
        self.add(vbox)

        self.progressbar = Gtk.ProgressBar()
        vbox.pack_start(self.progressbar, True, True, 0)

        self.timeout_id = GObject.timeout_add(50, self.on_timeout, None)

    def on_timeout(self, user_data):
        """
        Update value on the progress bar
        """
        self.progressbar.pulse()
        return True

win = ProgressBar()
win.connect("delete-event", Gtk.main_quit)
win.show_all()
Gtk.main()
